#******************************************************************
#
# Copyright 2017 Intel Mobile Communications GmbH All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
##
# Mini Plugin Manager build script
##

Import('env')

target_os = env.get('TARGET_OS')

manager_env = env.Clone()

print("Reading MPM script")

######################################################################
# Build flags
######################################################################
manager_env.PrependUnique(CPPPATH=[
    '#/resource/include',
    '#/bridging/include',
    '#/resource/c_common',
    '#/resource/c_common/ocrandom/include',
    '#/resource/c_common/oic_malloc/include',
    '#/resource/c_common/oic_string/include',
    '#/extlibs/rapidjson/include/rapidjson',
])

if target_os not in ['windows']:
    manager_env.AppendUnique(CXXFLAGS=['-std=c++0x', '-Wall', '-Wextra', '-Werror'])

manager_env.PrependUnique(LIBS=['mpmcommon'])

#####################################################################
# Source files and Target(s)
######################################################################
minipluginmanager_src = ['miniPluginManager.cpp']

if target_os in ['android', 'tizen']:
    mpmlib = manager_env.SharedLibrary('minipluginmanager', minipluginmanager_src)
else:
    mpmlib = manager_env.StaticLibrary('minipluginmanager', minipluginmanager_src)
manager_env.InstallTarget(mpmlib, 'minipluginmanager')
manager_env.UserInstallTargetLib(mpmlib, 'minipluginmanager')

